package es.us.lsi.daw.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class SingletonFactory {
	private static SessionFactory sessionFactory;

	public static SessionFactory getSessionFactory() {
		
		if(sessionFactory == null){
			sessionFactory = new Configuration().configure().buildSessionFactory();
		}
		
		return sessionFactory;
	}
	
	public static void setSessionFactory(SessionFactory sessionFactory) {
		SingletonFactory.sessionFactory = sessionFactory;
	}
}
